<?php
class ListAction extends Action {
    public function index(){
    	$id = $this->_get('tid');
    	$Cat = M('Category');
    	$cat = $Cat->field('name')->find($id);
    	$this->assign('cat',$cat['name']);
		$Model = M('Content');
		$where = array();
		$where['categoryId'] = $id;
		import("ORG.Util.Page"); // 导入分页类
		$count      = $Model->where($where)->count(); // 查询满足要求的总记录数
		$Page       = new Page($count,1); // 实例化分页类 传入总记录数和每页显示的记录数
		$show       = $Page->show(); // 分页显示输出
		 
		$list = $Model->where($where)->limit($Page->firstRow.','.$Page->listRows)->select();
		$this->assign('list',$list); // 赋值数据集
		$this->assign('page',$show); // 赋值分页输出
		$this->display();
    }
}